package com.pulaien.shop.controller.alibaba;

import com.pulaien.common.core.domain.AjaxResult;
import com.pulaien.common.utils.ConstantsUtil;
import com.pulaien.system.service.ConfigCategory1688Service;
import com.pulaien.system.service.alibaba.Billboard1688Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * Author yuan_lai
 * CreateTime 2024-03-06 9:45
 *
 * 查询1688榜单
 *  complex综合榜
 *  hot热卖榜
 *  goodPrice好价
 **/
@RestController
@RequestMapping("/billboard/1688" )
@Api(tags = "1688榜单")
@Slf4j
public class Billboard1688Controller {


    final
    Billboard1688Service billboard1688Service;
    final
    ConfigCategory1688Service configCategory1688Service;

    public Billboard1688Controller(Billboard1688Service billboard1688Service, ConfigCategory1688Service configCategory1688Service) {
        this.billboard1688Service = billboard1688Service;
        this.configCategory1688Service = configCategory1688Service;
    }



    //public AjaxResult


    @ApiOperation("/获取榜单排序前6的类目")
    @GetMapping("/category")
    public AjaxResult category() {
        return configCategory1688Service.shopCategory();
    }




    @ApiOperation("/综合榜")
    @GetMapping("/complex")
    public AjaxResult complex(
            @RequestParam String rankId,
            @RequestHeader(ConstantsUtil.HEAD_LANGUAGE) String lang
    ) {

        return billboard1688Service.complex(lang, rankId , 20);
    }




    @ApiOperation("/热门榜")
    @GetMapping("/hot")
    public AjaxResult hot(
            @RequestParam String rankId,
            @RequestHeader(ConstantsUtil.HEAD_LANGUAGE) String lang
    ) {

        return billboard1688Service.hot(lang, rankId , 20);
    }


    @ApiOperation("/好价榜")
    @GetMapping("/goodPrice")
    public AjaxResult goodPrice(
            @RequestParam String rankId,
            @RequestHeader(ConstantsUtil.HEAD_LANGUAGE) String lang
    ) {

        return billboard1688Service.goodPrice(lang, rankId , 20);
    }








}
